home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
pasprog.EXE
/
SCRMAKER.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1980-01-10
|
15KB
|
424 lines
Unit ScrMaker;
Interface
Uses Crt;
Type
Line = String[79];
Draw = Object
WallChar:Char;
WColor:Byte;
Header:Line;
HColor:Byte;
Status:Line;
SColor:Byte;
LineMode:Boolean;
LineStyle:Array[1..11] Of Byte;
DrawMode:Boolean;
Constructor Init(F1,B1:Byte;S:Char;F2,B2:Byte;L1:Line;
F3,B3:Byte;L2:Line);
Procedure InitWall;Virtual;
Procedure InitStatus;Virtual;
Procedure InitHeader;Virtual;
Procedure SetLineStyle(Mode:Boolean);Virtual;
Procedure Help;Virtual;
Procedure Run;
Destructor Done;
End;
Const
FileName:String[8]='ISIMSIZ';
FileExt:String[4]='.BIN';
SingleLine:Array[1..11] Of Byte=(218,191,192,217,196,179,194,193,195,180,197);
DoubleLine:Array[1..11] Of Byte=(201,187,200,188,205,186,203,202,204,185,206);
Procedure ScrToFile(FileName:Line);
Implementation
Procedure Go(X, Y:Byte);Assembler;
Asm
Mov Ah,02h
Mov Bh,00h
Mov Dh,Y
Mov Dl,X
Int 10h
End;
Procedure StdCursor;Assembler;
Asm
Mov Ax,0100h
Mov Cx,1e1fh
Int 10h
end;
Procedure BlockCursor;Assembler;
Asm
Mov Ax,0100h
Mov Cx,001fh
Int 10h
End;
Function Segment:word;
Begin
if (mem[0:$0410] and $30)=$30 then segment:=$b000
else segment:=$b800;
End;
Procedure ScrToFile(FileName:Line);
Var
ScrFile : File;
Begin
Assign(ScrFile,FileName);
{$I-} Reset(ScrFile, 4000); {$I+}
If IOResult <> 0 Then
Begin
{$I-} ReWrite(ScrFile, 4000); {$I+}
If IOResult <> 0 Then Exit;
End Else Seek(ScrFile,fileSize(ScrFile));
BlockWrite(ScrFile, Ptr(Segment, 0)^, 1);
Close(ScrFile);
End;
Constructor Draw.Init(F1,B1:Byte;S:Char;F2,B2:Byte;L1:Line;F3,B3:Byte;L2:Line);
Begin
WColor:=B1 Shl 4+F1;
HColor:=B2 Shl 4+F2;
SColor:=B3 Shl 4+F3;
WallChar:=S;
LineMode:=True;
SetLineStyle(LineMode);
Header:=L1;
Status:=L2;
InitWall;
InitHeader;
InitStatus;
Go(0,1);
DrawMode:=False;
End;
Procedure Draw.InitWall;
Var
Ix:Integer;
Begin
For Ix:=0 To 2000 Do
MemW[Segment:Ix*2]:=WColor Shl 8+Ord(WallChar);
End;
Procedure Draw.InitStatus;
Var
Ix:Integer;
Begin
For Ix:=1920 To 2000 Do
If Ix-1919>Length(Status) Then MemW[Segment:Ix*2]:=SColor Shl 8+32
Else MemW[Segment:Ix*2]:=SColor Shl 8+Ord(Status[Ix-1919]);
End;
Procedure Draw.InitHeader;
Var
Ix:Integer;
Begin
For Ix:=0 To 79 Do
If (Ix+1>(79-Length(Header)) Div 2+Length(Header))
Or (Ix+1<=(79-Length(Header)) Div 2)
Then MemW[Segment:Ix*2]:=HColor Shl 8+32
Else MemW[Segment:Ix*2]:=HColor Shl 8+
Ord(Header[Ix-((79-Length(Header)) Div 2)+1]);
End;
Procedure Draw.SetLineStyle(Mode:Boolean);
Var
Nx:Byte;
Begin
Case Mode Of
True :For Nx:=1 To 11 Do LineStyle[Nx]:=SingleLine[Nx];
False:For Nx:=1 To 11 Do LineStyle[Nx]:=DoubleLine[Nx];
End;
End;
Procedure Draw.Help;
Var
Save:Array[1..4000] Of Byte;
Key1:Char;
Begin
Move(Mem[Segment:0],Save[1],4000);
Go(30,7); Write ('┌───────[ Tuƒlar ]──────┐');
Go(30,8); Write ('│Ctrl ÿle │F7 ├,╠ │▓▓');
Go(30,9); Write ('│Home ┌,╔ │F8 ┤,╣ │▓▓');
Go(30,10);Write ('│End └,╚ │F9 ┬,╦ │▓▓');
Go(30,11);Write ('│PgUp ┐,╗ │F10 ┴,╩ │▓▓');
Go(30,12);Write ('│PgDn ┘,╝ │Oklar │,║ │▓▓');
Go(30,13);Write ('│PrtScr ┼,╬ │Oklar ─,═ │▓▓');
Go(30,14);Write ('└───────────┴───────────┘▓▓');
Go(33,15); Write ('▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓');
Repeat
Key1:=ReadKey;
Until Key1=#27;
Move(Save,Mem[Segment:0],4000);
End;
Procedure Draw.Run;
Var
Hea,Sta,Name:String;
Ch:Char;
Key:Word;
Ix,Jx,Res:Integer;
Front,Back:Byte;
Function ReadData(Adr:Word;L:Byte):String;
Var
Ref:String;
Ch,Res:Char;
Nx:Integer;
Begin
Ref:='';
For Nx:=1 To L Do
Begin
Go((Adr Mod 160) Div 2+Nx-1,Adr Div 160);
Ch:=ReadKey;
If KeyPressed Then Res:=ReadKey;
Case Ch Of
#27:Begin
ReadData:='-1';
Go((Ix Mod 160) Div 2,Ix Div 160);
Exit;
End;
#13:Break;
#8 :If Nx>=1 Then
Begin
Ref:=Copy(Ref,1,Length(Ref)-1);
Go((Adr Mod 160) Div 2+Nx-2,Adr Div 160);
Nx:=Nx-2;
MemW[Segment:Adr+Nx*2]:=WColor Shl 8+32;
Continue;
End;
End;
If Ch In [#32..#255] Then
Begin
Ref:=Ref+Ch;
MemW[Segment:Adr+(Nx-1)*2]:=WColor Shl 8+Ord(Ch);
End;
End;
Go((Ix Mod 160) Div 2,Ix Div 160);
ReadData:=Ref;
End;
Begin
Init(7,0,' ',0,7,'Ekran Editörü ['+FileName+FileExt+']',0,7,
' F1-Yardìm F2-Kayìt F3-Yeni F4-Tek\Çift F5-Renk F6-Yaz\Çiz Esc-Çìkìƒ');
BlockCursor;
Go(0,1);
Ix:=160;
Repeat
Ch:=ReadKey;
If (Ch=#0) And KeyPressed Then
Begin
Ch:=ReadKey;
Key:=Ord(Ch) Shl 8;
End Else Key:=Ord(Ch);
Case Key Of
27 :Done;
8 :If Ix>161 Then
Begin
For Jx:=Ix To Ix+158-(Ix Mod 160) Do
Begin
If Odd(Jx) Then Continue;
MemW[Segment:Jx-2]:=MemW[Segment:Jx];
End;
MemW[Segment:Jx]:=WColor Shl 8+Ord(WallChar);
Ix:=Ix-2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
20992:If Ix<3837 Then
Begin
For Jx:=Ix+156-(Ix Mod 160) DownTo Ix Do
Begin
If Odd(Jx) Then Continue;
MemW[Segment:Jx+2]:=MemW[Segment:Jx];
End;
MemW[Segment:Ix]:=WColor Shl 8+Ord(WallChar);
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
21248:Begin
For Jx:=Ix To Ix+158-(Ix Mod 160) Do
Begin
If Odd(Jx) Then Continue;
MemW[Segment:Jx]:=MemW[Segment:Jx+2];
End;
MemW[Segment:Jx]:=WColor Shl 8+Ord(WallChar);
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
9 :If Ix<3825 Then
Begin
Ix:=Ix+16;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
13 :If Ix<3680 Then
Begin
Ix:=Ix+160-Ix Mod 160;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
3840 :If Ix>15 Then
Begin
Ix:=Ix-16;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
0..31:;
15104:Begin
Help;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
15360:Begin
Hea:=Header;
Sta:=Status;
Go(0,24);ClrEol;Write(' Dosya Adì : [ ]');
Name:=ReadData(3868,8);
If (Name<>'-1') And (Name<>'') Then FileName:=Name;
Go(0,24);ClrEol;Write('Baƒlìk:[ ]');
Name:=ReadData(3856,69);
If Name<>'-1' Then Header:=Name
Else Header:='';
Go(0,24);ClrEol;Write('Alt Yazì:[ ]');
Name:=ReadData(3860,68);
If Name<>'-1' Then Status:=Name
Else Status:='';
InitHeader;
InitStatus;
ScrToFile(FileName+FileExt);
Repeat Until KeyPressed;
Header:='Ekran Editörü ['+FileName+FileExt+']';
Status:=' F1-Yardìm F2-Kayìt F3-Yeni F4-Tek\Çift F5-Renk F6-Yaz\Çiz Esc-Çìkìƒ';
InitHeader;
InitStatus;
End;
15616:Begin
FileName:='ISIMSIZ';
Init(7,0,' ',0,7,'Ekran Editörü ['+FileName+FileExt+']',0,7,
' F1-Yardìm F2-Kayìt F3-Yeni F4-Tek\Çift F5-Renk F6-Yaz\Çiz Esc-Çìkìƒ');
Ix:=160;
End;
15872:Begin
LineMode:=Not LineMode;
SetLineStyle(LineMode);
End;
16384:DrawMode:=Not DrawMode;
16128:Begin
Go(0,24);ClrEol;Write(' Yazì Rengi : [ ]');
Val(ReadData(3870,2),Jx,Res);
If (Res=0) And (Jx In [0..15]) Then Front:=Jx;
Go(0,24);ClrEol;Write(' Zemin Rengi : [ ]');
Val(ReadData(3872,1),Jx,Res);
If (Res=0) And (Jx In [0..7]) Then Back:=Jx;
WColor:=Back Shl 4+Front;
InitHeader;
InitStatus;
End;
19712:If Ix<3837 Then
Case DrawMode Of
False:Begin
If Ix<3837 Then Ix:=Ix+2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
True :Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[5];
If Ix<3837 Then Ix:=Ix+2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
End;
19200:Case DrawMode Of
False:Begin
If Ix>161 Then Ix:=Ix-2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
True :Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[5];
If Ix>161 Then Ix:=Ix-2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
End;
18432:Case DrawMode Of
False:Begin
If Ix>319 Then Ix:=Ix-160;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
True :Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[6];
If Ix>319 Then Ix:=Ix-160;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
End;
20480:Case DrawMode Of
False:Begin
If Ix<3680 Then Ix:=Ix+160;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
True :Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[6];
If Ix<3680 Then Ix:=Ix+160;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
End;
18176:Begin
Ix:=Ix-(Ix Mod 160);
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
20224:Begin
Ix:=Ix+158-(Ix Mod 160);
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
30464:Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[1];
If Ix<3837 Then Ix:=Ix+2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
33792:Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[2];
If Ix<3680 Then Ix:=Ix+160;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
29952:Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[3];
If Ix>319 Then Ix:=Ix-160;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
30208:Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[4];
If Ix>161 Then Ix:=Ix-2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
29696:Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[5];
If Ix<3837 Then Ix:=Ix+2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
17152:Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[7];
If Ix<3680 Then Ix:=Ix+160;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
17408:Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[8];
If Ix<3837 Then Ix:=Ix+2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
16640:Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[9];
If Ix<3837 Then Ix:=Ix+2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
16896:Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[10];
If Ix>161 Then Ix:=Ix-2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
29184:Begin
MemW[Segment:Ix]:=WColor Shl 8+LineStyle[11];
If Ix<3680 Then Ix:=Ix+160;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
Else If Key In [32..255] Then Begin
MemW[Segment:Ix]:=WColor Shl 8+Key;
If Ix<3837 Then Ix:=Ix+2;
Go((Ix Mod 160) Div 2,Ix Div 160);
End;
End;
Until 1=2;
End;
Destructor Draw.Done;
Begin
WColor:=7;
WallChar:=' ';
InitWall;
Go(0,0);
StdCursor;
Writeln('TurboSoft Screen Generator by Murat AKSARAY');
Halt;
End;
End.